<?php /* @var $this Controller */ ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="language" content="en" />
        <meta charset="utf-8" />
        <title></title>

        <!--<link href="http://cdn.bootcss.com/twitter-bootstrap/2.2.2/css/bootstrap-responsive.min.css" rel="stylesheet"/>-->
        <!--<link href="http://cdn.bootcss.com/prettify/r224/prettify.css" rel="stylesheet"/>-->
        <link href="<?php echo Yii::app()->request->baseUrl; ?>/css/docs.css" rel="stylesheet"/>
        <!--<link href="http://cdn.bootcss.com/prettify/r224/prettify.css" rel="stylesheet"></link>-->
        <!--    --> 

        <link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/css/jquery.handsontable.full.css" />
        <link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/bower_components/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css" />
        <link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/bower_components/bootstrap/dist/css/bootstrap.flatly.min.css"/>
        <link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/css/jquery-ui-1.10.4.custom.min.css"/>
        <link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/bower_components/bootstrap-datetimepicker/build/build_standalone.less" />
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/bower_components/jquery/dist/jquery.min.js"></script>
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/bower_components/jquery-ui/ui/jquery-ui.custom.js"></script>
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery.handsontable.full.js" type="text/javascript" charset="utf-8"></script>
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery-ui-timepicker-addon.js" type="text/javascript" charset="utf-8"></script>
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/js/jquery-ui-sliderAccess.js" type="text/javascript" charset="utf-8"></script>
        <script src="<?php echo Yii::app()->request->baseUrl; ?>/bower_components/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js" type="text/javascript" charset="utf-8"></script>


        <title><?php echo CHtml::encode($this->pageTitle); ?></title>
    </head>

    <body>
        <script type="text/javascript">

            function showAddDialog() {
                $("#main-modalLabel").html("");
                $("#main-modalLabel").append("快速添加排期");
                $("#main-modal-footer").html("");
                $("#main-modal-footer").append('<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>');
                $("#main-modal-footer").append('<button id="main-btn-reset" class="btn btn-primary" data-toggle="modal" >重置</button>');
                $("#main-modal-footer").append('<button id="main-save-schedule" type="button" class="btn btn-danger" onclick="save_schedule()">保存</button>');

                $('#main-addschedule-Modal').modal({
                    keyboard: false
                });
                $('#main-datetimepicker').datetimepicker({
                    minView: 'month',
                    autoclose: true
                }
                );
                //清空输入框
                $("#main-project").val("");
                $("#main-module").val("");
                $("#main-function").val("");
                $("#main-detail").val("");
                $("#main-people").val("");
                $("#main-datetimepicker").val("");

                $("#main-btn-reset").on('click', function() {  //增、改

                    $("#main-project").val("");
                    $("#main-module").val("");
                    $("#main-function").val("");
                    $("#main-detail").val("");
                    $("#main-people").val("");
                    $("#main-datetimepicker").val("");

                });
            }

            function save_schedule() {
                project = $("#main-project").val();
                module = $("#main-module").val();
                func = $("#main-function").val();
                detail = $("#main-detail").val();
                people = $("#main-people").val();
                dateline = $("#main-datetimepicker").val();
               
                $.ajax({
                    type: "post",
                    url: "/testdrive/index.php/schedule/addschedule",
                    data: {"project": project,
                        "module": module,
                        "func": func,
                        "detail": detail,
                        "people": people,
                        "dateline": dateline},
                    success: function(result) {
                        //  alert(result);
//                    alert(JSON.stringify(result));
                        $('#main-show-modal').modal({
                            keyboard: false
                        });

                        $("#main-show-modal-body-context").html("添加成功！");
                        $("#main-project").val("");
                        $("#main-module").val("");
                        $("#main-function").val("");
                        $("#main-detail").val("");
                        $("#main-people").val("");
                        $("#main-datetimepicker").val("");


                        //  alert("保存成功！");
                        if (result != null) {
                            //   alert(result.toString()+"恭喜，保存成功！");
                            // alert( result.toJSONString());

                        } else {
                            alert("不好意思，保存失败喽....");
                        }
                        //    var results = JSON.parse(result);


                    },
                    error: function() {
                        alert("保存失败！再尝试一下....");
                    }
                }
                );

            }

        </script>
        <div class="container" id="page">

            <!--导航栏-->

            <div id="main-nav" class="container">

                <nav class="navbar navbar-default" role="navigation">
                    <div class="container-fluid">
                        <div class="navbar-header">
                            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
                                <span class="sr-only">Toggle navigation</span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                                <span class="icon-bar"></span>
                            </button>
                            <a class="navbar-brand" href="#"><?php echo CHtml::encode(Yii::app()->name); ?></a>
                        </div>

                        <div id="mainmenu" class="collapse navbar-collapse" >
                            <?php
                            $this->widget('zii.widgets.CMenu', array(
                                'items' => array(
                                    array('label' => '今日排期', 'url' => array('/site/index')),
                                    //  array('label' => '测试', 'url' => array('/schedule/test', 'view' => 'test')),
                                    array('label' => '排期列表', 'url' => array('/schedule/test2', 'view' => 'test2')),
                                    //                                         array('label' => '测试3', 'url' => array('/schedule/test3', 'view' => 'test3')),
                                    array('label' => '排期详情', 'url' => array('/schedule/scheduleDetails', 'view' => 'scheduleDetails')),
                                    array('label' => '项目管理', 'url' => array('/schedule/proManagement', 'view' => 'proManagement')),
//                                      array('label' => '显示', 'url' => array('/test/show', 'view' => 'show')),
                                //      array('label' => '登录', 'url' => array('/site/login'), 'visible' => Yii::app()->user->isGuest),
                                //     array('label' => '退出 (' . Yii::app()->user->name . ')', 'url' => array('/site/logout'), 'visible' => !Yii::app()->user->isGuest)
                                ),
                            ));
                            ?>
                            <ul class="nav navbar-nav navbar-right">
                                <li><a href="#" id="li-addschedule" onclick="showAddDialog()">快速添加排期</a></li>
                                <!--未来扩展个人信息用-->
                                <!--        <li class="dropdown">
                                          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
                                          <ul class="dropdown-menu" role="menu">
                                            <li><a href="#">Action</a></li>
                                            <li><a href="#">Another action</a></li>
                                            <li><a href="#">Something else here</a></li>
                                            <li class="divider"></li>
                                            <li><a href="#">Separated link</a></li>
                                          </ul>
                                        </li>-->
                            </ul>
                        </div><!-- mainmenu -->

                    </div>
                </nav>
            </div>

<?php if (isset($this->breadcrumbs)): ?>
                <?php
                $this->widget('zii.widgets.CBreadcrumbs', array(
                    'links' => $this->breadcrumbs,
                ));
                ?><!-- breadcrumbs -->
            <?php endif ?>
            <?php echo $content; ?>

            <div class="clear"></div>


            <!--footer页面部分-->

            <div id="footer" style="margin: 10px 20px;font-size: 0.8em;text-align: center;padding-right: 15px; padding-left: 15px; border-top: 2px solid #000000;border-top-width:2px;">

                Copyright &copy; <?php echo date('Y'); ?> by My Company.<br/>
                All Rights Reserved.<br/>
<?php echo Yii::t('yii', 'Powered by {yii}.', array('{yii}' => '<a href="http://pocdoc.cn/" rel="external">郁香尚医软件科技有限公司</a>')); ?>
            </div><!-- footer    class="col-md-12"  -->

            <!--弹窗口的div-->

            <div class="modal fade" id="main-addschedule-Modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                            <h4 class="modal-title" id="main-modalLabel"></h4>
                        </div>
                        <div class="modal-body">
                            <div id="main-modal-body-context">
                                <div class="input-group"><span class="input-group-addon">项目</span><input id="main-project" type="text" class="form-control" placeholder="不超过8个字哦"></div>
                                <div class="input-group"><span class="input-group-addon">模块</span><input id="main-module" type="text" class="form-control" placeholder="不超过8个字哦"></div>
                                <div class="input-group"><span class="input-group-addon">功能</span><input id="main-function" type="text" class="form-control" placeholder="不超过8个字哦"></div>
                                <div class="input-group"><span class="input-group-addon">详情</span><input id="main-detail" type="text" class="form-control" placeholder="随便输入"></div>
                                <div class="input-group"><span class="input-group-addon">人员</span><input id="main-people" type="text" class="form-control" placeholder="一个负责人就OK"></div>
                                <div class="input-group"><span class="input-group-addon">时间</span> <input type="text"  id="main-datetimepicker" class="form-control" data-date-format="yyyy-mm-dd"></div>
                                <!--<div class="input-group input-append date form_datetime" id="time-div" ><span class="input-group-addon">时间</span><input id="time" class="form-control" type="text" ><span class="add-on"><i class="icon-th"></i></span></div>-->



                            </div>
                            <div class="modal-footer" id="main-modal-footer">
                                <!--                                                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                                                                <button id="main-btn-reset" class="btn btn-primary" data-toggle="modal" >重置</button>
                                                                                <button id="main-save-schedule" type="button" class="btn btn-danger" onclick="save_schedule()">保存</button>-->

                                <!--        <button type="button" class="btn btn-primary">Save changes</button>-->
                            </div>


                        </div>
                    </div>
                </div>
            </div> <!--弹窗口的div-->
            <!--提示框-->
            <div class="modal fade" id="main-show-modal" tabindex="-1" role="dialog" aria-labelledby="main-show-modalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
                            <h4 class="modal-title" id="main-show-modalLabel">提示</h4>
                        </div>
                        <div class="modal-body">
                            <div id="main-show-modal-body-context"></div>
                            <div class="modal-footer">
                                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                <!--        <button type="button" class="btn btn-primary">Save changes</button>-->
                            </div>


                        </div>
                    </div>
                </div>
            </div><!--提示框-->
        </div><!-- page -->
        <!--<div id="baseUrl"><?php echo Yii::app()->request->baseUrl; ?></div>-->

    </body>
</html>
